package TCP回显服务器;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TCPDictionaryService extends TCPServer{
    Map<String,String> dic=new HashMap<>();
    public TCPDictionaryService(int port) throws IOException {
        super(port);
        dic.put("cat","小猫");
        dic.put("dog","小狗");
        dic.put("cxk","小鸡");
        dic.put("pig","小猪");
    }
    @Override
     public String process(String request) {
        return dic.getOrDefault(request,"这个词咱也不知道啊");
    }

    public static void main(String[] args) throws IOException {
        TCPDictionaryService tcpDictionaryService=new TCPDictionaryService(8000);
        tcpDictionaryService.start();
    }
}
